package com.fa4j.product.stock.convert;

import com.fa4j.common.base.convert.ConverterConfig;
import com.fa4j.product.stock.model.Stock;
import com.fa4j.product.stock.model.StockRecord;
import org.mapstruct.BeanMapping;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(config = ConverterConfig.class)
public interface StockConverter {

    @BeanMapping(ignoreByDefault = true)
    @Mapping(target = "stockId", source = "id")
    @Mapping(target = "version", source = "version")
    @Mapping(target = "operatorId", source = "operatorId")
    @Mapping(target = "afterQuantity", source = "quantity")
    @Mapping(target = "afterLockQuantity", source = "lockQuantity")
    @Mapping(target = "afterTotalQuantity", source = "totalQuantity")
    StockRecord toStockRecord(Stock stock);
}
